import {BrowserModule} from '@angular/platform-browser';
import {NgModule} from '@angular/core';
import {FormsModule} from '@angular/forms';
import {HttpModule} from '@angular/http';
import {RouterModule, Routes} from '@angular/router';

import {AppComponent} from './app.component';
import {HeaderComponent} from './views/header/header.component';
import {FooterComponent} from './views/footer/footer.component';
import {HomeComponent} from './views/home/home.component';
import {DetailComponent} from './views/detail/detail.component';
import {HttpService} from './service/http.service';
import {SearchComponent} from './views/search/search.component';
import {FilePipe} from './utils/fileSize.pipe';
import {WishComponent} from './views/wish/wish.component';
import {LoginComponent} from './views/login/login.component';
import {CommentComponent} from './views/comment/comment.component';
import {PersonalComponent} from './views/personal/personal.component';
import {RegisterComponent} from './views/register/register.component';
import {SexPipe} from './utils/sex';

const routes: Routes = [
  {path: '', redirectTo: '/home', pathMatch: 'full'},
  {path: 'home', component: HomeComponent},
  {path: 'detail/:id', component: DetailComponent},
  {path: 'search/:key', component: SearchComponent},
  {path: 'wish', component: WishComponent},
  {path: 'login', component: LoginComponent},
  {path: 'comments', component: CommentComponent},
  {path: 'personal', component: PersonalComponent},
  {path: 'register', component: RegisterComponent}
];

@NgModule({
  declarations: [
    AppComponent,
    HeaderComponent,
    FooterComponent,
    HomeComponent,
    SearchComponent,
    DetailComponent,
    FilePipe,
    WishComponent,
    LoginComponent,
    CommentComponent,
    PersonalComponent,
    RegisterComponent,
    SexPipe
  ],
  imports: [
    BrowserModule,
    FormsModule,
    HttpModule,
    RouterModule.forRoot(routes)
  ],
  providers: [HttpService],
  bootstrap: [AppComponent]
})
export class AppModule {
}
